#include "BaseService.h"
#include <stdio.h>

int BaseService_Init(MYSQL ** conn)
{
	if (conn == NULL)
	{
		return -1;
	}

	MYSQL * t_conn;
	t_conn = mysql_init(NULL);
	t_conn = mysql_real_connect(t_conn, "127.0.0.1", "root", "9904wcnm", "DBGameServer", 0, NULL, 0);
	*conn = t_conn;
	return 0;
}

int BaseService_StmtInit(MYSQL_STMT ** const stmt, MYSQL * conn)
{
	if (stmt == NULL)
	{
		return -1;
	}
	MYSQL_STMT * t_stmt = mysql_stmt_init(conn);
	*stmt = t_stmt;
	return 0;
}

int BaseService_StmtClose(MYSQL_STMT * stmt)
{
	mysql_stmt_close(stmt);
	return 0;
}

int BaseService_Close(MYSQL * conn)
{
	if (conn == NULL)
	{
		return -1;
	}
	mysql_close(conn);
	return 0;
}

